package com.sl.proxy.server.base.proxy;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 服务端代理配置
 *
 * @author: aoshiguchen
 * @date: 2022/6/16
 */
@Data
@ConfigurationProperties(prefix = "square.lake")
public class ProxyConfig {
    /**
     * 传输协议相关配置
     */
    private Protocol protocol = new Protocol();
    /**
     * 代理服务配置
     */
    private Server server = new Server();
    /**
     * 代理隧道配置
     */
    private Tunnel tunnel = new Tunnel();

    @Data
    public static class Protocol {
        private Integer maxFrameLength = 2097152;
        private Integer lengthFieldOffset = 0;
        private Integer lengthFieldLength = 4;
        private Integer initialBytesToStrip = 0;
        private Integer lengthAdjustment = 0;
        private Integer readIdleTime = 120;
        private Integer writeIdleTime = 20;
        private Integer allIdleTimeSeconds = 0;
    }

    @Data
    public static class Server {
        private Tcp tcp = new Tcp();
        private Udp udp = new Udp();
    }

    @Data
    public static class Tunnel {
        private Integer bossThreadCount = 2;
        private Integer workThreadCount = 10;
        private Integer port = 9000;
        private Integer sslPort = 9002;
        private String keyStorePassword = "123456";
        private String keyManagerPassword = "123456";
        private String jksPath = "/test.jks";
        private Boolean transferLogEnable = true;
        private Boolean heartbeatLogEnable = true;
    }

    @Data
    public static class Tcp {
        private Integer bossThreadCount = 5;
        private Integer workThreadCount = 20;
        private String domainName;
        private Integer httpProxyPort = 80;
        private Integer httpsProxyPort = 443;
        private String keyStorePassword;
        private String jksPath;
        private Boolean transferLogEnable = true;
    }

    @Data
    public static class Udp {
        private Integer bossThreadCount = 5;
        private Integer workThreadCount = 20;
        private Boolean transferLogEnable = true;
    }
}
